<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Object Test2</title>
</head>
<body>
<script> 
function Score(mid, kor, eng){
	this.mid = mid;
	this.kor = kor;
	this.eng = eng;
	this.tot=0;
	this.avg=0;
	this.compute = function(){
		this.tot = this.kor + this.eng;
		this.avg = this. tot/2;
	}
	
	this.getTot = function() {return this.tot;}
	this.getAvg = function() {return this.avg;}	
}
	var array = new Array();
	var s1 = new Score('kim', 90,50);
	var s2 = new Score('park', 60,70);
	

   	s1.compute();
   	s2.compute();
   	
   	array.push(s1);
	array.push(s2);
	
   	for(a=0; a<array.length; a++){
   		document.write(array[a].mid + "<br/>");
   		document.write(array[a].getTot() +"<br/>");
   		document.write(array[a].getAvg() + "<p>");
   	}
</script>
</body>
</html>